package net.xju3_4.service.impl;

import net.xju3_4.dao.MerchantDao;
import net.xju3_4.dao.OrderDao;
import net.xju3_4.dao.PaymentDao;
import net.xju3_4.dao.UserDao;
import net.xju3_4.service.AdminPaymentService;

import java.util.HashMap;
import java.util.Map;

public class AdminPaymentImpl implements AdminPaymentService {
    private PaymentDao paymentDao=new PaymentDao();
    private UserDao userDao=new UserDao();
    private MerchantDao merchantDao=new MerchantDao();
    private OrderDao orderDao=new OrderDao();
    @Override
    public Map<String, Integer> statistics() {
    Map<String, Integer> users   =userDao.count();
    Map<String, Integer> merchants=merchantDao.count();
    Map<String, Integer>   payments=paymentDao.count1();
    Map<String, Integer> orders   =orderDao.count();
    int totalUser=users.get("totalUser");
    int totalMerchant=merchants.get("totalMerchant");
    int totalPayment=payments.get("totalPayment");
    int activeUser=users.get("activeUser");
    int activeMerchant=merchants.get("activeMerchant");
    int activePayment=payments.get("activePayment");
    int forbidUser=users.get("forbidUser");
    int forbidMerchant=merchants.get("forbidMerchant");
    int forbidPayment=payments.get("forbidPayment");
    int totalOrder=orders.get("totalOrder");
    int activeOrder=orders.get("activeOrder");
    int forbidOrder=orders.get("forbidOrder");
    Map<String, Integer> result=new HashMap<>();
    result.put("totalUser", totalUser);
    result.put("totalMerchant", totalMerchant);
    result.put("totalPayment", totalPayment);
    result.put("totalOrder", totalOrder);
    result.put("activeUser", activeUser);
    result.put("activeMerchant", activeMerchant);
    result.put("activePayment", activePayment);
    result.put("activeOrder", activeOrder);
    result.put("forbidUser", forbidUser);
    result.put("forbidMerchant", forbidMerchant);
    result.put("forbidPayment", forbidPayment);
    result.put("forbidOrder", forbidOrder);
    return result;

    }
}
